#ifndef BASE_SYSTEM_LOG_LOGGER_INCLUDE_LOG_FORMATTER_H
#define BASE_SYSTEM_LOG_LOGGER_INCLUDE_LOG_FORMATTER_H

#include "log_stream.h"

namespace Base {
namespace SystemLog {
class LogFormatter {
public:
    virtual ~LogFormatter() = default;
    virtual void Format(LogStream &stream) const = 0;
};

// 时间格式化器
class TimeFormatter : public LogFormatter {
public:
    explicit TimeFormatter(const char* format = "%Y-%m-%d %H:%M:%S")
        : format_(format) {}
    void Format(LogStream &stream) const override;
private:
    const char* format_;
};

// 时间格式化器（包含毫秒）
class TimeFormatterWithMilliseconds : public LogFormatter {
public:
    explicit TimeFormatterWithMilliseconds(const char* format = "%Y-%m-%d %H:%M:%S")
        : format_(format) {}
    void Format(LogStream &stream) const override;
private:
    const char* format_;
};

// 日志级别格式化器
class LevelFormatter : public LogFormatter {
public:
    void Format(LogStream &stream) const override;
};

// 线程ID格式化器
class ThreadIdFormatter : public LogFormatter {
public:
    void Format(LogStream& stream) const override;
};


// 文件名和行号格式化器
class FileFormatter : public LogFormatter {
public:
    void Format(LogStream& stream) const override;
};

// 消息格式化器（占位符）
class MessageFormatter : public LogFormatter {
public:
    void Format([[maybe_unused]] LogStream& stream) const override;
};
} // namespace SystemLog
} // namespace Base

#endif // BASE_SYSTEM_LOG_LOGGER_INCLUDE_LOG_FORMATTER_H